package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.StrategyReplyUserComment;
import cn.wolfcode.trip.base.service.IStrategyUserCommentService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * lituan
 * 回复资源工资器
 */
@RestController
@RequestMapping("/strategyUserComments")
public class StrategyUserCommentController {

    @Autowired
    private IStrategyUserCommentService userCommentService;

    /**lituan
     * 添加回复
     * @param replyUserComment
     * @return
     */
    @PostMapping("/{strategyUserComment.id}/strategyReplyUserComments")
    public JSONResult saveReplyUserComment(StrategyReplyUserComment replyUserComment){
        JSONResult jsonResult = new JSONResult();
        try {
            userCommentService.saveReplyUserComment(replyUserComment);
        } catch (Exception e) {
            jsonResult.mark("保存失败,稍后再试");
            e.printStackTrace();
        }

        return jsonResult;
    }
}
